	<title>设置权限</title>
	<style>
		a{ color:green!important; }
	</style>
	<link rel="stylesheet" type="text/css" href="__STATIC__/js/layui256/layui/css/layui.css">
</head>
<body>
	<div class="layui-tab">
		<div class="layui-col-md12">
			<div id="set-rbac-tree"></div>
		</div>
	</div>
<script src="__STATIC__/js/jquery.js"></script>
<script src="__STATIC__/js/layui256/layui/layui.all.js"></script>
<script src="__STATIC__/js/layer/layer.js"></script>
<script>
var data = {$list};
var tree = null;
layui.use( 'tree' , function(){
	tree = layui.tree;
	var indexTree = tree.render({
		elem: "#set-rbac-tree",
		data:data,
		id:'set-rbac-tree',
		showLine:false,
		showCheckbox: true,
		onlyIconControl:false,
	});
} );

var getChecked = function( index , roleId ){
	var list = tree.getChecked('set-rbac-tree');
	var menus = [];
	var getMenu = function( list ){
		$.each( list , function( key , item ){
			menus.push( item.id );
			if( item.children.lenth != 0  ){
				var tmp = getMenu( item.children );
				menus.concat( tmp );
			}
		});
	}
	$menus = getMenu( list );
	$.post( '{:url("authorization/RbacMenu/setRoleAuthPost")}', { roleId:roleId , list:menus } , function( data ){
		//data = JSON.parse( data );
		let icon = ( data.code == 200 )? 1 : 5;
		parent.layer.msg( data.message , { offset:"50%",  icon:icon , time:600 } ,function(){
			parent.layer.close(index);
		} );
	} , 'json' );
	return ;
}

</script>
</body>
</html>